package com.qianyu.project.web.controller.smj;

import com.qianyu.project.entity.ApplyLaborPayment;
import com.qianyu.project.entity.Perform;
import com.qianyu.project.service.smj.smjPerformService;
import com.qianyu.project.utils.Result;
import com.qianyu.project.utils.ResultTool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("smj_perform")
public class smjPerformController {
    @Autowired
    private smjPerformService ps;

    @GetMapping("")
    public String Addperform(String apply_date,String p_id,String ctr_id,String company_id,String perform_name,String contract_amount,String penalty,String withhold,String agree_amount,String agree_upper,String handler_id,String settle_comment,String attach_ids){
        return ps.Addperform( apply_date, p_id, ctr_id, company_id, perform_name, contract_amount, penalty, withhold,  agree_amount, agree_upper, handler_id, settle_comment, attach_ids);
    }

    @GetMapping("/work_list")
    public void Addworklist(String perform_id,String work_content,String work_count,String unit,String unit_price,String snumber,String hnumber,String comment){
         ps.Addworklist( perform_id, work_content, work_count, unit, unit_price, snumber, hnumber, comment);
    }

    @PostMapping("/Flow_Perform")//提交审批
    public Integer FlowPerform(@RequestBody Perform perform){
        return  ps.FlowPerform(perform);
    }

    @GetMapping("/listPerform")
    public Result listPerform(@RequestParam Map<String,String> params){
        Map<String, Object> map =new HashMap<>();
        //查询合同
        map.put("data", ps.listPerform(params));
        return ResultTool.success(map);
    }

    @GetMapping("/getWorkList")
    public List<Map<String, Object>> getWorkList(String perform_id){
        return ps.getWorkList(perform_id);
    }

    @GetMapping("/getfromaudit")
    public List<Map<String, Object>> getfromaudit(String perform_id){
        return ps.getfromaudit(perform_id);
    }
}
